1. Field of the Invention
This invention relates to computing systems and more particularly to context switching operations in a multi-tasking environment having, for example, a multi-processor architecture.
2. Description of the Related Art
Multi-tasking generally involves the concurrent execution of several programs in a computer by, for example, time slicing program execution. Computer users have the impression that the programs are executed in parallel when, in actuality, the computer switches between the programs. When program execution is time sliced, a program runs for a period of time before being "context switched out" (task switched) to run another program.
When resuming a context switched out program, the program should resume execution at the precise location where execution previously ended. In anticipation of later resuming the context switched out program, a processor undergoes a process of saving the state of the program being context switched out prior to the processor loading and running another program. This program state is represented in various memory locations by the state of the processor.
Context switching is transparent to the programmer of the context switched out program because, from the perspective of the programmer, context switching occurs at arbitrary times and thus at arbitrary locations in the program. Additionally, the operating system that implements the context switching does not know the state of the program being context switched out. As a result, all processor state information must be saved when the program is context switched out The processor state information includes all architectural and software visible registers as well as any memory locations that are mapped to addresses known only within the processor such as scratch pad memory.